﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Transactions.lot {
    import Engine.Transactions.*;
    import Classes.*;
    import Classes.orders.*;

    public class TLotOrderPlace extends Transaction {

        private var m_lotOrder:LotOrder;
        private var m_onFinish:Function = null;

        public function TLotOrderPlace(_arg1:String, _arg2:int, _arg3:String, _arg4:String, _arg5:int, _arg6:Function){
            this.m_lotOrder = new LotOrder(_arg1, Global.player.snUser.uid, _arg2, _arg3, _arg4, _arg5, OrderStatus.SENT);
            this.m_onFinish = _arg6;
            Global.world.orderMgr.placeOrder(this.m_lotOrder);
            var _local7:Item = Global.gameSettings.getItemByName(_arg3);
            if (_local7.cost > 0){
                Global.player.gold = (Global.player.gold - _local7.cost);
            } else {
                if (_local7.cash > 0){
                    Global.player.cash = (Global.player.cash - _local7.cash);
                };
            };
            if (_local7.plantXp > 0){
                Global.player.xp = (Global.player.xp + _local7.plantXp);
            };
            super();
        }
        override public function perform():void{
            signedCall("LotOrderService.placeOrder", this.m_lotOrder.getParams());
        }
        override protected function onComplete(_arg1:Object):void{
            if (this.m_onFinish != null){
                this.m_onFinish(_arg1);
            };
        }

    }
}//package Transactions.lot 
